home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1997 November & December / Amiga-CD 1997 #11-12.iso / pd-disketten / dms-gepackt / 9_95 / apd-9-95-2.dms / apd-9-95-2.adf / Tips&Tricks / VieleFenster.c < prev    next >
C/C++ Source or Header  |  1995-08-22  |  642b  |  34 lines

  1. static int ct = 0;
  2. ULONG sig_in;
  3.  
  4. struct Window *OpenMWindow(struct TagItem *wintags,
  5.                 struct MsgPort *userport,ULONG idcmps)
  6. {
  7.   struct Window *win=0l;
  8.  
  9.   if(win=OpenWindowTagList(0l,wintags))
  10.   {
  11.     win->UserPort=userport;
  12.     ModifyIDCMP(win,idcmps);
  13.     ct++;
  14.     sig_in|=(1L<<userport->mp_SigBit);
  15.   }
  16.   return(win);
  17. }
  18.  
  19. void CloseMWindow(struct Window *win)
  20. {
  21.   struct IntuiMessage *imsg;
  22.  
  23.   if(win)
  24.   {
  25.     ct--;
  26.     if(!(ct)) sig_in&=~(1L<<win->UserPort->mp_SigBit);
  27.     Forbid();
  28.     while(imsg=GetMsg(win->UserPort)) ReplyMsg(imsg);
  29.     win->UserPort=0l;ModifyIDCMP(win,0l);
  30.     Permit();
  31.     CloseWindow(win);
  32.   }
  33. }
  34.